cmake_minimum_required(VERSION 2.8.3)
project(lidar_detect)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pthread  -fexceptions -mstackrealign" )
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /opt/ros/noetic/)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

find_package(catkin REQUIRED COMPONENTS
    pcl_conversions pcl_ros roscpp 
    sensor_msgs eigen_conversions tf
    geometry_msgs genmsg cmake_modules
    cv_bridge image_transport message_generation
)


add_message_files(  
  FILES
  keypoint.msg
  lidar_3d.msg
  lidar_objects.msg
  raw_data_point.msg
)

generate_messages(DEPENDENCIES std_msgs)

catkin_package(CATKIN_DEPENDS message_runtime std_msgs)

include_directories(${catkin_INCLUDE_DIRS} {PCL_INCLUDE_DIRS})

FILE(GLOB_RECURSE TOOLS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/util/*.cpp)
FILE(GLOB_RECURSE ADAPTERS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/adapters/*.cpp)
FILE(GLOB_RECURSE COMMUNICATION_SRC ${CMAKE_CURRENT_SOURCE_DIR}/iot_communication/*.cpp)
FILE(GLOB_RECURSE LIDAR_PROCESS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/task_process/*.cpp)
FILE(GLOB_RECURSE DATA_MANAGEMENT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/data_manager/*.cpp)

link_directories(${CMAKE_CURRENT_SOURCE_DIR}/thirdlib)

add_executable (${PROJECT_NAME} main.cpp ${ADAPTERS_SRC} ${COMMUNICATION_SRC} ${LIDAR_PROCESS_SRC} ${DATA_MANAGEMENT_SRC})
target_link_libraries (${PROJECT_NAME}
    ${PROJECT_NAME}_tools_static mosquitto curl ${catkin_LIBRARIES} ${PCL_LIBRARIES}
)

SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
ADD_LIBRARY(${PROJECT_NAME}_tools_static STATIC  ${TOOLS_SRC} )

#add_subdirectory(auto_map)
